var Nopal = function(){
	this.version = '0.1a';
	this.jsDiagram;
}
Nopal.jsDiagram = function(name, width, height, element, options){
	this.Object;
	
	this.name		= name;
	this.e		 	= element;
	this.width		= width;
	this.height		= height;
	this.objects 	= new Array();
	this.options	= options;
	this.id_object_selected = null;
	
	this.mode = null;
	
	this.init = function(){
		$(this.e).addClass('diagram');
		$(this.e).append('<div id="toolbar"></div>');
		this.initToolbar();
		$(this.e).append('<div id="content" style=" height:'+(this.height-50)+'px;"></div>');
		$(this.e).append('<div id="statusbar"></div>');
		$(this.e).css('overflow','auto');
		$(this.e).css('width',this.width);
		$(this.e).css('height',this.height);
		//add frame
		$(this.e+' > #content ').append('<iframa id="frame1" src="../resource/dummy.html" height="100%" width="100%"></iframe>');
		
		alert($(this.e+' > #content > #iframe1').contents().find("#mydiv").html())

	}
	this.initToolbar = function(){
		$(this.e+' > #toolbar').append('<button id="add_node">Cuadro</button>');
		$(this.e+' > #toolbar').append('<button id="add_line">Line</button>');
		var o = this;
		$(this.div+' > #toolbar > #add_node').click(function(){
				//diagram.setMode('node');
				n = new Node();
				o.addObject(n);
				o.objects[(o.objects.length - 1)].init();
				
		});
		$(this.e+' > #toolbar > #add_line').click(function(){
				//diagram.setMode('node');
				c = new Connector(diagram,200,300,500,500);
				o.addObject(c);
				o.objects[(o.objects.length - 1)].init();
		});
		//$(this.e+' > #toolbar > ul').append('<li>Clase</li>');
		//$(this.e+' > #toolbar > ul').append('<li>Conector</li>');
		//$(this.e+' > #toolbar > ul').append('<li></li>');
	}
	this.getNextNumObject = function(){
		return this.objects.length;
	}
}


